#!/bin/sh

# PROVIDE: pcbsdinit
# REQUIRE: DAEMON cups
# KEYWORD: nojail shutdown

. /etc/rc.subr

name="pcbsdinit"
rcvar=pcbsdinit_enable

stop_cmd="pcbsdinit_stop"
start_cmd="pcbsdinit_start"

load_rc_config $name

: ${pcbsdinit_enable=NO}

pcbsdinit_start()
{
	echo "Starting PC-BSD init.."
	if [ -e "/var/.pcbsd-firstboot" ] ; then
		(/usr/local/share/pcbsd/scripts/first-boot.sh >/dev/null 2>/dev/null ; rm /var/.pcbsd-firstboot)&
	fi

	# Cleanup cups print jobs
	/usr/local/bin/cancel -a 2>/dev/null >/dev/null

	# Change Xorg priority
	( sleep 40; rtprio 31 -`pgrep Xorg` 2>/dev/null)&
}

pcbsdinit_stop()
{
}

run_rc_command "$1"
